#ifndef _VERTEX_H
#define _VERTEX_H

#include <cassert>
#include <vector>
#include "vectors.h"
#include "edge.h"
//#include "cloth.h"
// ==========================================================
class ClothParticle;

class Vertex {

public:

  // ========================
  // CONSTRUCTOR & DESTRUCTOR
  Vertex(int i, const Vec3f &pos) : position(pos) { index = i; erased=false; cutLeft=false; cutRight=false; cutDown=false; \
    cutUp=false; relationshipParticle=NULL; counter=0; specialEdge=NULL; specialEdgePartner=NULL; specialEdge2=NULL; specialEdgePartner2=NULL; clearedClean=false;}
  ~Vertex() {}
  
  // =========
  // ACCESSORS
  int getIndex() const { return index; }
  double x() const { return position.x(); }
  double y() const { return position.y(); }
  double z() const { return position.z(); }
  const Vec3f& getPos() const { return position; }
  const Vec3f& getOriginalPos() const { return originalposition; }
  
  Vec3f normal;
  std::vector<int> neighbors;
  bool erased;
  int counter;
  Edge *specialEdge;
  Vertex *specialEdgePartner;
  Edge *specialEdge2;
  Vertex *specialEdgePartner2;
  bool cleaned;
  bool clearedClean;
    
  ClothParticle *relationshipParticle;

  // =========
  // MODIFIERS
  void setPos(Vec3f v) { position = v; }
  void setOriginalPos(Vec3f v) { originalposition = v; }
  Vertex() { assert(0); }
  
  bool cutLeft, cutRight, cutDown, cutUp;

private:

  // don't use these constructors
  
  Vertex& operator=(const Vertex&) { assert(0); exit(0); }
  Vertex(const Vertex&) { assert(0); }
  
  // ==============
  // REPRESENTATION
  Vec3f position;
  Vec3f originalposition;

  // this is the index from the original .obj file.
  // technically not part of the half-edge data structure, 
  // but we use it for hashing
  int index;  

  // NOTE: the vertices don't know anything about adjacency.  In some
  // versions of this data structure they have a pointer to one of
  // their incoming edges.  However, this data is very complicated to
  // maintain during mesh manipulation, so it has been omitted.

};

// ==========================================================

#endif

